package com.example.usercenter.exception;

import com.example.usercenter.enums.StatusEnum;

/**
 * @Author hhf
 * @Date 2024/8/29
 * @Description
 */
public class BusinessException extends RuntimeException{

    private int code;

    private  String description;

    private String msg;

    public BusinessException(String msg, int code, String description) {

        super(msg);
        this.code = code;
        this.description = description;
    }

    public BusinessException(StatusEnum statusEnum,String description){
        super(statusEnum.getMsg());
        this.code = statusEnum.getCode();
        this.description = description;
    }

    public BusinessException(StatusEnum statusEnum){
        super(statusEnum.getMsg());
        this.code = statusEnum.getCode();
        this.description = statusEnum.getMsg();
    }




    public String getDescription() {
        return description;
    }

    public int getCode() {
        return code;
    }
}
